package com.copote.vmp.transport.controller;

import com.copote.vmp.basedata.feign.BasedataAPI;
import com.copote.vmp.basedata.model.Result;
import com.copote.vmp.basedata.model.entity.VehicleInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/biddingForm")
@Api(tags = "竞价单")
public class BiddingFormController {

    @Resource
    private BasedataAPI basedataAPI;

    @GetMapping(value = "/query")
    @ApiOperation(value = "查询车辆详情")
    public VehicleInfo queryVehicleInfo() {
        Result<VehicleInfo> result = basedataAPI.getVehicleInfo("1");
        return result.getResult();
    }

    @GetMapping(value = "/save")
    @ApiOperation(value = "保存车辆数据")
    public Boolean saveVehicleInfo() {
        VehicleInfo vehicleInfo = new VehicleInfo();
        vehicleInfo.setId("2")
                .setPlatesNumber("湘A66666");
        Result<?> result = basedataAPI.saveVehicleInfo(vehicleInfo);
        return result.isSuccess();
    }
}
